program yanghuitriangle
    implicit none
    integer na,i,j
    parameter (na=20)
    integer pst(na,na)

    do i=1,na !two sides equal 1
        pst(i,1)=1
        pst(i,i)=1
    end do
    do i=3,na
        do j=2,i-1
            pst(i,j)=pst(i-1,j-1)+pst(i-1,j)
        end do
    end do

    do i=1,na
        write (*,10) (pst(i,j),j=1,i)
10    format (/20x,20i6)
    end do

end program

